void     clearviewport        (void);
void     closegraph           (int window=ALL_WINDOWS);
int      getactivepage        (void);
void     getarccoords         (struct arccoordstype *arccoords);
int      getcurrentwindow     (void); 
int      getdisplaycolor      (int color);
int      getgraphmode         (void);
char*    getmodename          (int mode_number);
void     gettextsettings      (struct textsettingstype *texttypeinfo);
void     getviewsettings      (struct viewporttype *viewport);
int      getvisualpage        (void);
int      getwindowheight      (void);
int      getwindowwidth       (void);
void     initgraph            (int *graphdriver, int *graphmode, char *pathtodriver);
int      initwindow           (int width, int height, const char* title="Windows BGI", int left=0, int top=0, bool dbflag=false, bool closeflag=true); 
void     setactivepage        (int page);
void     setcurrentwindow     (int window); 
unsigned setgraphbufsize      (unsigned bufsize); 


void     graphdefaults        (void);
char*    grapherrormsg        (int errorcode);
int      graphresult          (void);

void     cleardevice          (void);


void     putpixel             (int x, int y, int color); 
int      getpixel             (int x, int y);
void     moverel              (int dx, int dy);
void     linerel              (int dx, int dy);
void     moveto               (int x, int y);
void     lineto               (int x, int y);
void     line                 (int x1, int y1, int x2, int y2);
void     rectangle            (int left, int top, int right, int bottom);
void     bar                  (int left, int top, int right, int bottom);
void     bar3d                (int left, int top, int right, int bottom, int depth, int topflag);
void     arc                  (int x, int y, int stangle, int endangle, int radius);
void     pieslice             (int x, int y, int stangle, int endangle, int radius);
void     circle               (int x, int y, int radius);
void     ellipse              (int x, int y, int stangle, int endangle, int xradius, int yradius);
void     fillellipse          (int x, int y, int xradius, int yradius);
void     drawpoly             (int numpoints, int *polypoints);
void     fillpoly             (int numpoints, int *polypoints);
void     floodfill            (int x, int y, int border);
void     sector               (int x, int y, int stangle, int endangle, int xradius, int yradius);
void     setbkcolor           (int color);
void     setcolor             (int color); 
void     setfillpattern       (char *upattern, int color); 
void     setfillstyle         (int pattern, int color); 
void     setlinestyle         (int linestyle, unsigned upattern, int thickness);
void     setpalette           (int colornum, int color); 
int      getbkcolor           (void);
int      getcolor             (void);
void     getlinesettings      (struct linesettingstype *lineinfo);
void     getfillpattern       (char *pattern); 
void     getfillsettings      (struct fillsettingstype *fillinfo);


int      converttorgb         (int color);
void     delay                (int millisec);
void     detectgraph          (int *graphdriver, int *graphmode);
void     getaspectratio       (int *xasp, int *yasp);
struct   palettetype* getdefaultpalette (void);
char*    getdrivername        (void);
void     clearmouseclick      (int kind);
int      getmaxcolor          (void);
int      getmaxmode           (void); 
int      getmaxheight         (void);
int      getmaxwidth          (void);
int      getmaxx              (void);
int      getmaxy              (void);
void     getmoderange         (int graphdriver, int *lomode, int *himode);
void     getmouseclick        (int kind, int& x, int& y);
void     getpalette           (struct palettetype *palette);
int      getpalettesize       (void); 
int      getx                 (void);
int      gety                 (void);
bool     ismouseclick         (int kind);
int      mousex               (void);
int      mousey               (void);
int      installuserdriver    (char *name, int huge (*detect)(void)); 
int      installuserfont      (char *name); 
int      getch                (void);
int      kbhit                (void);
void     putimage             (int left, int top, void *bitmap, int op);
void     getimage             (int left, int top, int right, int bottom, void *bitmap);
unsigned imagesize            (int left, int top, int right, int bottom);
void     readimagefile (
	const char* filename=NULL,
	int left=0, int top=0, int right=INT_MAX, int bottom=INT_MAX
);
void     printimage (
	const char* title=NULL, double width_inches=7, 
	double border_left_inches=0.75, double border_top_inches=0.75,
	int left=0, int right=0, int right=INT_MAX, int bottom=INT_MAX
);
void     writeimagefile (
	const char* filename=NULL,
	double width_inches=7, double border_left_inches=0.75, double border_top_inches=0.75,
	int left=0, int top=0, int right=INT_MAX, int bottom=INT_MAX
);
int      registerbgidriver    (void (*driver)(void)); 
int      registerbgifont      (void (*font)(void)); 
void     registermousehandler (int kind, void h(int, int));
void     restorecrtmode       (void); 
		//  COLOR(r,g,b), 
		//  RED_VALUE(v), GREEN_VALUE(v), BLUE_VALUE(v), 
		//  IS_BGI_COLOR(v), IS_RGB_COLOR(v)
void     setallpalette        (struct palettetype *palette); 
void     setaspectratio       (int xasp, int yasp);
void     setmousequeuestatus  (int kind, bool status=true);
void     setgraphmode         (int mode); 
void     setrgbpalette        (int colornum, int red, int green, int blue); 
void     setviewport          (int left, int top, int right, int bottom, int clip);
void     setvisualpage        (int page);
int      swapbuffers          (void); 
void     settextjustify       (int horiz, int vert);
void     settextstyle         (int font, int direction, int charsize);
void     setusercharsize      (int multx, int divx, int multy, int divy);
void     setwritemode         (int mode);
int      showerrorbox         (const char *message);
int      textheight           (char *textstring);
int      textwidth            (char *textstring);
void     outtext              (char *textstring);
void     outtextxy            (int x, int y, char *textstring);